package com.jf.cloud.service.sysmanager.constant;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * TODO 用户申请赛事状态基础常量
 */
public enum UserMatchConstant {

	/**
	 * 待审核
	 */
	USER_MATCH_10(10, "待审核"),
	/**
	 * 通过
	 */
	USER_MATCH_20(20, "通过"),
	/**
	 * 拒绝
	 */
	USER_MATCH_30(30, "拒绝"),
	/**
	 * 移除
	 */
	USER_MATCH_40(40, "移除"),
	/**
	 * 赛事取消移除
	 */
	USER_MATCH_50(50, "赛事取消移除"),
	/**
	 * 赛事结束
	 */
	USER_MATCH_60(60, "赛事结束");

	/**
	 * 数据字典ID
	 */
	private Integer id;

	/**
	 * 数据字典名称
	 */
	private String name;

	private UserMatchConstant(Integer id, String name) {
		this.id = id;
		this.name = name;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * 通过ID 查找名字
	 */
	public String findName(Integer Id) {
		UserMatchConstant[] tyList = UserMatchConstant.values();
		for (int i = 0; i < tyList.length; i++) {
			if (tyList[i] != null && tyList[i].id.equals(Id)) {
				return tyList[i].name;
			}
		}
		return "";
	}

	/**
	 * 获取数据字典选项列表
	 */
	public static List<Map<String, Object>> getDataDictList() {
		List<Map<String, Object>> dataDictList = new ArrayList<Map<String, Object>>();
		for (UserMatchConstant e : UserMatchConstant.values()) {
			Map<String, Object> option = new HashMap<String, Object>();
			option.put("value", e.getId());
			option.put("label", e.getName());
			dataDictList.add(option);
		}
		return dataDictList;
	}

	/**
	 * 重写父类方法
	 */
	public String toString() {
		return this.name;
	}

}